Skip to content

Preserve run context for detached sub-runs - #122

Open
nishu-builder wants to merge 1 commit into
mainfrom
codex/sub-run
Open

Preserve run context for detached sub-runs#122
nishu-builder wants to merge 1 commit into
mainfrom
codex/sub-run

Conversation

@nishu-builder

Copy link
Copy Markdown
Contributor

Summary

  • replace worker-side run-async top-level dispatch with a server-owned sub-run primitive
  • recover the launching job through its short-lived nonce and carry parent stack + parent request, trace identity, and the complete secret store
  • keep stack and secrets out of the runner payload and worker filesystem; the child receives only its own reader-matched grants
  • retain detached execution and durable async conversation recovery

Why

Detached work should have the same execution context semantics as run-then and map-then. Serializing delegated grants into workers both duplicates the secret model and loses secrets that the parent worker itself was not authorized to read.

POST /sub-run now routes admission back to the compute thread that owns the in-flight parent. That thread validates the prepared request, clones its server-held context, and starts the child without waiting for its result. The nonce expires with the parent job.

Validation

  • cargo test --workspace
  • cargo fmt --all -- --check
  • nix build
  • CAOS_SALT=$(date --iso=s) result/bin/caos-cli run-tool test (44/44 passed)
  • focused fresh-salt cargo-self and chat-offline retries after updating the EC2 test stack
  • git diff --check

PR #113 will be retargeted onto this PR and will contain only conversation secret loading and request identity changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant